

#import "NSString+DirExp.h"

@implementation NSString (DirExp)

- (NSString *)cacheDir
{
    //获取当前字符串可以使用谁? self :表示调用cacheDir的字符串本身
    
    
    //1.0  获取沙盒的cache目录
    NSString *cachePath  =[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
    
    //2.0  将当前self字符串拼接到cachePath后面
    //小细节：self：[http://wwww.baidu.com/1.png lastPathComponent] => 1.png
    //测试出的结果：lastPathComponent :利用/进行分割的
    return [cachePath stringByAppendingPathComponent:[self lastPathComponent]];
}

@end
